const { tools } = require('./myFn/tools.js')
const axios = require('axios')
function noPunch (msg) {
  let p = tools.getData()
  axios.get(`http://miubai.website:8084/noPunch/${p}`)
    .then(res => {
      let outputInfo = res.data.nopunch.trim()
      let info = '@' + outputInfo.split(' ').join('\n@')
      if (info == "@") {
        msg.reply('今天大家都很棒，已全部提交!')
        return
      }
      msg.reply(`截图未交:\n${info}`, false)
      msg.reply('核酸截图提交到网站\n主http://miubai.website\n备用http://miubai.website:8084\n做完就交！', false)
    })
    .catch(e => {
      console.log(e.response.status)
      if (e.response.status === 500) {
        msg.reply('今天还没有人提交哦~', true)
      }
      else {
        msg.reply(`查询失败\n${e}`, false)
      }
    })


}
module.exports.noPunch = noPunch